package com.qlylkj.lbk.ui.cochain

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.qlylkj.lbk.R
import com.qlylkj.lbk.model.bean.CoChainInfo

class CoChainRecordAdapter: BaseQuickAdapter<CoChainInfo, BaseViewHolder>(R.layout.item_cochain_record) {

    override fun convert(helper: BaseViewHolder, item: CoChainInfo?) {
        helper.run {
            item?.run {
                setImageResource(R.id.cochainStatusImage,when(status){
                    0 -> R.mipmap.ic_cochain_audit
                    1 -> R.mipmap.ic_cochain_success
                    else -> R.mipmap.ic_cochain_failed
                })
               setText(R.id.cochainStatusText,when(status){
                   0 -> "上链中"
                   1 -> "上链成功"
                   else -> "上链失败"
               })
                setText(R.id.transactionHashText,transactionHash)
                setText(R.id.timeText,createTime)
            }
        }
    }
}